package io;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

public class ReadStringDemo {
    public static void main(String[] args) throws IOException {
        File file = new File("fos.txt");
        long d = file.length();

        FileInputStream fis = new FileInputStream("fos.txt");
        // 创建一个字节数组
        byte[] buf = new byte[(int)d];
        fis.read(buf);
        String s = new String(buf);
        System.out.println(s);
        fis.close();

    }
}
